<script setup lang="ts">
import CollectItem from "@/components/mine/CollectItem.vue"
import { useRouter } from "vue-router"
import { useCounterStore } from "@/stores/counter"
import { storeToRefs } from "pinia"
const router = useRouter();
const store = useCounterStore();
const { collectData } = storeToRefs(store);
</script>
<template>
  <div class="fixed-zbest collect-detail">
    <header class="header">
      <van-icon class="header-icon" name="arrow-left" @click.stop="router.go(-1)" />
      <div class="header-text">收藏详情</div>
    </header>
    <div class="content" v-if="collectData.length">
      <CollectItem v-for="(item, index) in collectData" :key="index" :item="item" />
    </div>
    <div class="content" v-else>
      <div class="nothing">
        <div class="img-box animate__animated animate__bounceInDown animate__slow">
          <img src="@/assets/images/shopcart/1678328261551.png" alt="">
        </div>
        <div class="nothing-text animate__animated animate__bounceInRight animate__slow">暂无数据</div>
        <div class="nothing-btn animate__animated animate__bounceInLeft animate__slow" @click.stop="router.push('/home')">
          去逛逛</div>
      </div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.collect-detail {
  width: 100%;
  overflow: scroll;
  background-color: var(--bgc-gray);

  &::-webkit-scrollbar {
    display: none;
  }

  .header {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 10;
    width: 100%;
    height: .5rem;
    box-sizing: border-box;
    font-size: .2rem;
    line-height: .5rem;
    padding: 0 .15rem;
    display: flex;
    align-items: center;
    background-color: var(--bgc-white);

    .header-icon {
      font-size: .15rem;
    }

    .header-text {
      flex-grow: 1;
      font-size: .18rem;
      text-align: center;
    }
  }

  .content {
    width: 100%;
    min-height: calc(100vh - .5rem);
    background-color: var(--bgc-gray);

    .nothing {
      width: 100%;
      box-sizing: border-box;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      padding-top: .8rem;

      .img-box {
        width: .9rem;
        height: .9rem;
      }

      .nothing-text {
        margin-top: .3rem;
        margin-bottom: .2rem;
        color: var(--text-gray2);
        opacity: .6;
      }

      .nothing-btn {
        position: relative;
        width: 1.2rem;
        height: .44rem;
        background-color: var(--bgc-red-deep);
        background-image: linear-gradient(to right, var(--bgc-red), var(--bgc-red-deep), var(--bgc-red));
        color: var(--text-white);
        font-size: .16rem;
        border-radius: .04rem;
        line-height: .44rem;
        text-align: center;
      }
    }
  }
}
</style>